package org.appfuse.dao.hibernate;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.appfuse.dao.Bj77DAO;
import org.appfuse.model.Bj77;
import org.appfuse.model.Bj77Id;
import org.hibernate.Query;

/**
 * Data access object (DAO) for domain model class Bj77.
 * 
 * @see org.appfuse.dao.Bj77
 * @author MyEclipse Persistence Tools
 */

public class Bj77DAOHibernate extends BaseDaoHibernate implements Bj77DAO {
	private static final Log log = LogFactory.getLog(Bj77DAOHibernate.class);

	// property constants
	public static final String DM_GRP = "dmGrp";

	public static final String DM_CPT = "dmCpt";

	public static final String DM_LEV_COD = "dmLevCod";

	public static final String DM_ABR1 = "dmAbr1";

	public static final String DM_ABR2 = "dmAbr2";

	public static final String INP_ABR = "inpAbr";

	public static final String DM_HND = "dmHnd";

	public static final String INP_FRQ = "inpFrq";

	public static final String YES_PRV = "yesPrv";

	public static final String ATTRIBUTE = "attribute";

	public void save(Bj77 transientInstance) {
		log.debug("saving Bj77 instance");
		try {
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(Bj77 persistentInstance) {
		log.debug("deleting Bj77 instance");
		try {
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public Bj77 findById(Bj77Id id) {
		log.debug("getting Bj77 instance with id: " + id);
		try {
			Bj77 instance = (Bj77) getSession().get("org.appfuse.model.Bj77",
					id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findAll() {

		log.debug("finding all Bj77 instance");
		try {
			String queryString = "from Bj77 as model ";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}

	}
}